package com.czxy.dem01;

public class Test14 {
    public static void main(String[] args) {

        String str = "this is a test of java";

        int s = getCharNum('s');
        System.out.println("s出现了"+s+"次");

        String[] s1 = str.split(" ");
        for (int i = 0; i < s1.length; i++) {
            System.out.println(s1[3]);
            break;
        }
        str=str.replace("java","JAVASE");
        System.out.println(str);
    }
    public static int getCharNum(char c){
        String str = "this is a test of java";
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            if (c==str.charAt(i)) {
                count++;
            }
        }
        return count;
    }
}
